package com.system.auth;

import com.module.admin.cli.pojo.CliInfo;
import com.module.admin.cli.service.CliInfoService;
import com.system.comm.utils.FrameMd5Util;
import com.system.comm.utils.FrameSpringBeanUtil;

/**
 * 惊讶SSO
 * @author  duanbin
 * @date    2016年5月25日 下午3:09:29 
 * @version 1.0.0
 */
public class AuthCons {

	/*private static List<AuthClient> clientList = new ArrayList<AuthClient>();
	private static Map<String, AuthClient> clientMap = new HashMap<String, AuthClient>();
	
	static {
		AuthClient client = new AuthClient("156915408", "测试调用", "http://127.0.0.1", "aej7a39dw97ecb783d6y32f44139r9dl", "http://127.0.0.1/callback.htm");
		clientMap.put(client.getId(), client);
		clientList.add(client);
		
		
	}*/
	
	/**
	 * 根据ID获取对象
	 * @param sercret
	 * @return
	 */
	public static String getId(String id) {
		CliInfoService cliInfoService = FrameSpringBeanUtil.getBean(CliInfoService.class);
		CliInfo cliInfo = cliInfoService.get(id);
		if(cliInfo != null) {
			return cliInfo.getToken();
		}
		return null;
	}
	
	/**
	 * 根据域名获取
	 * @param domain
	 * @return
	 */
	/*public static AuthClient getDomain(String domain) {
		for (AuthClient client : clientList) {
			if(client.getDomain().equals(domain)) {
				return client;
			}
		}
		return null;
	}*/
	
	public static void main(String[] args) {
		String strMing = "196845782";
		//String lgst = DESUtil.getInstance().getEncString(strMing);
		String lgst = FrameMd5Util.getInstance().encodePassword(strMing);
		System.out.println(lgst);
	}
}
